import request from '@/utils/request'

// 获取角色列表
export function getRolesList(params) {
    return request({
        url: '/role/roleList',
        method: 'get',
        params
    })
  }
  
  // 分配权限 /authorize/:id
  export function authorize(rid, data) {
    return request({
        url: `/roleMenu/authorize/${rid}`,
        method: 'post',
        data
    })
  }
  // 获取分配权限弹窗内所需全部路由菜单数据 /aoaoe/api/getAllRouter 
  export function getAllRouter() {
    return request({
        url: `/aoaoe/api/getAllRouter`,
        method: 'get',
    })
  }
  // 新增角色
  export function addRoles(data) {
    return request({
        url: '/role/roleAdd',
        method: 'post',
        data
    })
  }
  //编辑角色
  export function editRoles(data) {
    return request({
        url: '/role/updateRole/',
        method: 'post',
        data
    })
  }
  // 删除角色 /role/delete/:id
  export function deleteRole(id) {
    return request({
        url: `/role/deleteRole/${id}`,
        method: 'post'
    })
  }

  export function updateRoleState(params) {
    return request({
      url: '/role/updateRoleState',
      method: 'get',
      params
    })
  }

  export function rolePermissions(id) {
    return request({
      url: `/role/rolePermissions/${id}`,
      method: 'get'
    })
  }